import {merge} from "lodash";
import {ref} from "vue";
// 默认
let baseOpt = {
    tooltip: {
        trigger: 'item'
    },
    legend: {
        type: 'scroll',
        orient: 'vertical',
        left: 'right',
        padding: [0,0,10,0],
        itemGap: 10
    },
    grid: {
        containLabel: true,
    },
    series:
        {
            name: '',
            type: 'pie',
            radius: '50%',
            // right: '120',
            label: {
                color: '#6296bb'
            }
        }
}

export const  testPie = (data) =>{
    let {series} = data
    let option = {
        series: [merge({}, baseOpt.series, {
            data: series[0].data,
            label: {
                formatter: '{d}%'
            },
            tooltip: {
                formatter: (e) => {
                    return e.marker + ' ' + e.data.name + ' '+ ' ' + e.data.value
                }
            }
        })]
    };
    return merge({}, baseOpt, option)
}
